﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

using ZFB.Common;
using ZFB.IServices;

namespace ZFB.WebAPI.Controllers
{
    /// <summary>
    /// 区域
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class RegionController : ControllerBase
    {
        private readonly IRegionServices _services;

        public RegionController(IRegionServices services)
        {
            _services = services;
        }

        /// <summary>
        /// 根据Id获取区域信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ApiResult> GetByIdA(long id) 
        {
            return await _services.GetByIdAsync(id);
        }
        /// <summary>
        /// 获得某个城市下的区域
        /// </summary>
        /// <param name="cityid"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ApiResult> GetAll(long cityid) 
        {
            return await _services.GetAllAsync(cityid);
        }
    }
}
